page.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. "use client";
  2. import ActivityMask from "@/components/ModalPopup/ActivityModal";
  3. import { useRouter } from "@/i18n/routing";
  4. import { useSearchParams } from "next/navigation";
  5. import { useEffect, useState } from "react";
  6. const Page = () => {
  7. const searchParams = useSearchParams();
  8. const url = decodeURIComponent(`${searchParams}`);
  9. const router = useRouter();
  10. const handler = (event: MessageEvent) => {
  11. if (event.data === "closeMessage") {
  12. router.push("/");
  13. }
  14. };
  15. useEffect(() => {
  16. // @ts-ignore
  17. window.quit = () => {
  18. router.push("/");
  19. };
  20. window.addEventListener("message", handler);
  21. return () => window.removeEventListener("message", handler);
  22. }, []);
  23. // 关闭iframe弹窗
  24. const [categoryName, setCategoryName] = useState<string>("")
  25. useEffect(() => {
  26. const parmas: any = new URLSearchParams(url)
  27. setCategoryName(parmas.get('category_name'))
  28. }, [url]);
  29. const goBlack = () => {
  30. router.push("/")
  31. }
  32. return (
  33. <>
  34. <div style={{ width: "100%", height: "100%" }}>
  35. {/* 真人游戏添加关闭按钮 */}
  36. {
  37. categoryName === "Live Casino Jogos" && <i
  38. className={"iconfont icon-guanbi"}
  39. style={{
  40. position: 'fixed',
  41. top: '0.1rem',
  42. right: '0.1rem',
  43. zIndex: "99999",
  44. fontSize: '.2rem'
  45. }}
  46. onClick={goBlack}
  47. ></i>
  48. }
  49. <iframe src={url} width={"100%"} height={"100%"}></iframe>
  50. </div>
  51. {/* 数千补偿 */}
  52. <ActivityMask />
  53. </>
  54. );
  55. };
  56. export default Page;